<!--
 * @Author: 小孩_晓孩 1534579168@qq.com
 * @Date: 2024-08-21 09:47:04
 * @LastEditors: 小孩_晓孩 1534579168@qq.com
 * @LastEditTime: 2024-08-21 11:08:38
 * @FilePath: \heima-shop\src\pagesMember\settings\settings.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <view class="viewport">
    <view class="list" v-if="memberStore.profile">
      <navigator url="/pagesMember/address/address" hover-class="none" class="item arrow">
        我的收货地址
      </navigator>
    </view>
    <!-- 列表2 -->
    <view class="list">
      <view hover-class="none" class="item arrow" open-type="openSetting">授权管理</view>
      <view hover-class="none" class="item arrow" open-type="feedback">问题反馈</view>
      <view hover-class="none" class="item arrow" open-type="contact">联系我们</view>
    </view>
    <!-- 列表3 -->
    <view class="list">
      <navigator hover-class="none" class="item arrow" url=" ">关于小兔鲜儿</navigator>
    </view>
    <!-- 操作按钮 -->
    <view class="action" v-if="memberStore.profile">
      <view class="button" @tap="logout">退出登录</view>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { useMemberStore } from '@/stores/index'
const memberStore = useMemberStore()
const logout = () => {
  // 显示模态框
  uni.showModal({
    content: '是否退出登录？',
    success: function (res) {
      if (res.confirm) {
        // 清空用户信息
        memberStore.clearProfile()
        // 返回上一页
        uni.navigateBack()
      }
    },
  })
}
</script>

<style lang="scss">
page {
  background-color: #f4f4f4;
}

.viewport {
  padding: 20rpx;
  .list {
    padding: 0 20rpx;
    background-color: #fff;
    border-radius: 20rpx;
    margin-bottom: 20rpx;
    .item {
      line-height: 90rpx;
      padding-left: 10rpx;
      font-size: 30rpx;
      border-top: 1rpx solid #ddd;
      color: #333;
      position: relative;
      text-align: left;
      border-radius: 0;
      background-color: #fff;
      &:first-child {
        border: none;
      }
    }
    .arrow::after {
      content: '\e6c2';
      position: absolute;
      top: 50%;
      right: 0;
      color: #ccc;
      font-family: 'erabbit' !important;
      font-size: 32rpx;
      transform: translateY(-50%);
    }
  }
  .action {
    line-height: 90rpx;
    margin-top: 40rpx;
    font-size: 32rpx;
    color: #333;
    text-align: center;
    .button {
      background-color: #fff;
      margin-bottom: 20rpx;
      border-radius: 10rpx;
    }
  }
}
</style>
